﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace olierFrm.WebFormDev.Session
{
    public class SSession
    {
        /// <summary>
        /// 用户
        /// </summary>
        public static SUser User
        {
            get
            {
                if (HttpContext.Current.Session == null || HttpContext.Current.Session[SUser.SessionID] == null)
                {
                    HttpContext.Current.Session[SUser.SessionID] = new SUser();
                }
                return (SUser)HttpContext.Current.Session[SUser.SessionID];
            }
            set
            {
                HttpContext.Current.Session[SUser.SessionID] = value;
            }
        }

        public static SMenu Menu
        {
            get
            {
                if (HttpContext.Current.Session[SMenu.SessionID] == null)
                    return null;
                return (SMenu)HttpContext.Current.Session[SMenu.SessionID];
            }
            set
            {
                HttpContext.Current.Session[SMenu.SessionID] = value;
            }
        }

        public static SSmartLookup SmartLookup
        {
            get
            {
                if (HttpContext.Current.Session[SSmartLookup.SessionID] != null)
                    return (SSmartLookup)HttpContext.Current.Session[SSmartLookup.SessionID];
                return null;
            }
        }


        public static STheme Theme
        {
            get
            {
                if (HttpContext.Current.Session[STheme.SessionID] == null) return null;
                return (STheme)HttpContext.Current.Session[STheme.SessionID];
            }
            set
            {
                if (HttpContext.Current.Session[STheme.SessionID] == null)
                    HttpContext.Current.Session[STheme.SessionID] = new STheme();
                HttpContext.Current.Session[STheme.SessionID] = value;
            }
        }
    }
}
